#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;
class Solution {
public:
    int leastBricks(vector<vector<int>>& wall) {
        unordered_map<int, int> temp;
        for (int i = 0; i < wall.size(); ++i)
        {
            int m = 0;
            for (int j = 0; j < wall[i].size() - 1; ++j)
            {
                m += wall[i][j];
                if (temp[m])
                    temp[m]++;
                else temp[m] = 1;
            }
        }
        int val = 0;
        for (auto i = temp.begin(); i != temp.end(); i++)
        {
            val = max(val, i->second);
        }
        return wall.size() - val;
    }
};





int  main()
{
	return 0;
}